Skip to content

feat: add Vue 2/3 and Svelte SFC support with calibrated Vue Reference ranges - #162

Merged
avidianity merged 1 commit into
mainfrom
feat/vue-svelte-sfc
Nov 22, 2026
Merged

avidianity merged 1 commit into
mainfrom
feat/vue-svelte-sfc

Conversation

@avidianity

Copy link
Copy Markdown
Owner

Summary

Extend the built-in typescript-javascript Language plugin to extract and measure script blocks from .vue (Vue 2 and Vue 3) and .svelte Single-File Components, preserving original 1-based line numbers and cross-file .ts/.js/.vue/.svelte Import cycles.
Calibrate separate 20-repository pre-2023 Reference range panels for Vue 2 (ADR 0014) and Vue 3 (ADR 0015) — 40 repositories total — and automatically select the matching Reference range when .vue files are measured and package.json declares vue major version 2 or 3.

Closes #159

Tier

Tier 3 from the tier check: plugins/languages/ts/tests/conformance.rs updates the declared extensions assertion to include svelte and vue.

Task

Spec #159:

  • Extract script, script setup, script context="module", and script module blocks from .vue and .svelte files (respecting lang="ts", lang="tsx", and lang="jsx", skipping HTML templates and CSS styles, preserving exact 1-based line numbers).
  • Resolve cross-file imports between .ts/.js and .vue/.svelte inside typescript-javascript.
  • Calibrate 20 pre-2023 Vue 2 repositories (docs/adr/0014-vue2-reference-ranges.md) and 20 pre-2023 Vue 3 repositories (docs/adr/0015-vue3-reference-ranges.md) — 40 repositories total.
  • Auto-select Vue 2 or Vue 3 Reference ranges from package.json when .vue files are measured.
  • Update plugins/languages/ts/HOW-TO.md, README.md, docs/guide/languages.md, and llms.txt.

Fail-first test

  • Test: plugins/languages/ts/tests/sfc.rs::sfc_without_script_is_empty_and_unclosed_script_is_unparsable (Unicode <中文> tag case)
  • Before the change: panicked with a UTF-8 char-boundary error when non-ASCII tags appeared inside .vue templates during the 40-repository panel run.
  • After the change: passed (starts_with_tag and starts_with_close_tag operate on byte slices).

Checks

Check Result
cargo clippy --workspace --all-targets -- -D warnings passed
cargo test --workspace --locked passed (including 5 new tests/sfc.rs tests and 88 tests/conformance.rs tests)
cargo run --package xtask -- merged-result passed
cargo run --package codeint-cli -- diff origin/main passed (0 regressions, all ratios improved)
Pre-commit and commit-msg hooks (secrets, links, duplicates, format, repository, markdown, message) passed

Safety proof

  • Safety fact: plugins/languages/ts/src/sfc.rs compiles with #![forbid(unsafe_code)], performs all tag matching on ASCII byte slices without UTF-8 boundary slicing panics, and leaves existing .ts/.tsx/.js/.jsx/.mts/.cts/.mjs/.cjs lowering unchanged.
  • Proof: cargo test --workspace --locked passed and the release binary measured 40 real pre-2023 Vue repositories (20 Vue 2 + 20 Vue 3) with 0 unparsable files and 0 panics.
  • interrogate: verified against Vue 2 Options API, Vue 3 dual-script script + script setup, Svelte module + instance scripts, empty/template-only SFCs, unclosed script tags, and non-ASCII Unicode template tags.

Runtime evidence

  • Build revision: 84ff5fb (release build on Apple Silicon)
  • Verified across 20 pre-2023 Vue 2 repositories (ADR 0014, 0.010s to 1.375s per repo, 0 unparsable) and 20 pre-2023 Vue 3 repositories (ADR 0015, 0.008s to 0.490s per repo, 0 unparsable).

Gaps

  • Deferred coverage: none
  • Pre-existing failures: none
  • Environmental failures: none

@github-actions github-actions Bot added the tier-3 Tier 3 from the tier check label Nov 22, 2026
@avidianity
avidianity merged commit c6d7026 into main Nov 22, 2026
13 checks passed
@avidianity
avidianity deleted the feat/vue-svelte-sfc branch November 22, 2026 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tier-3 Tier 3 from the tier check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Spec: Vue 2/3 and Svelte SFC support with separate Vue 2 and Vue 3 Reference ranges

1 participant